#! /usr/bin/python
# -*- coding: utf-8 -*-

import os
import sys
import time
from datetime import datetime
import app_global
from data_set import *


log = app_global.gLog

def app_run():
    log.info("sys run...[{}]".format(datetime.now()))
    dset = CDataSetter()
    dset.start()

    try:
        while True:
            
            time.sleep(app_global.ONE_DAY_IN_SECONDS)
            log.info("sys sleep [{}]".format(datetime.now()))

    except KeyboardInterrupt:
        log.info("catch ctrl+c, interrupt app")
        app_global.SYS_RUN = False

    dset.join()

if __name__== "__main__":
    app_run()
